﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
namespace tdgame {
    class MathExtras {
        public const double RAD = Math.PI / 180.0;

        public static double CalculateAngle(double x1, double y1, double x2, double y2) {
            return ((-Math.Atan2(y2 - y1, x2 - x1) / RAD) + 360.0) % 360.0;
        }

        public static double Calculate3DDistance(Vector3 pt1, Vector3 pt2) {
            return Calculate3DDistance(pt1.X, pt1.Y, pt1.Z, pt2.X, pt2.Y, pt2.Z);
        }

        public static double Calculate3DDistance(double x1, double y1, double z1, double x2, double y2, double z2) {
            return Math.Sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)) + ((z2 - z1) * (z2 - z1)));
        }

        public static double Calculate2DDistance(Point pt1, Point pt2) {
            return Calculate2DDistance(pt1.X, pt1.Y, pt2.X, pt2.Y);
        }

        public static double Calculate2DDistance(double x1, double y1, double x2, double y2) {
            return Math.Sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));
        }

    }
}
